#include <mc/handblock.h>
#include <iostream>

namespace mc
{
HandBlock::HandBlock(BlockType type): 
    _type(type), _block(BlockFactory::getBlock(type)) {}
 
HandBlock::~HandBlock() noexcept
{
    delete this->_block;
    this->_block = nullptr;
}

void HandBlock::switchBlock(BlockType type)
{
    delete this->_block;
    this->_type = type;
    this->_block = BlockFactory::getBlock(type);

}

void HandBlock::firstPersonViewDraw(const glm::mat4& model)
{
    if (this->_block == nullptr) 
        return;

    this->_block->positions().clear();
    this->_block->positions().push_back(model);
    this->_block->updatePositions();

    this->_block->draw();
}

}